﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SimSpike
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string userName = txtBoxUsername.Text.ToString();
            string passWord = txtBoxPassword.Text.ToString();
            if (InputUtility.ValidateString(userName) && InputUtility.ValidateString(passWord))
            {
                if (userName == "coordinator")
                {
                    frmCoordinatorStart coordinatorStart = new frmCoordinatorStart();
                    coordinatorStart.Show();
                    this.Hide();
                }
                else if (userName == "judge")
                {
                    JudgeScreen11 judge = new JudgeScreen11();
                    judge.Show();
                    this.Hide();
                }
            }
            else
            {
                MessageBox.Show("The username or password you have provided is incorrect. Please try again or login as guest.", "Incorrect input", MessageBoxButtons.OKCancel);
            }
        }

        private void btnGuest_Click(object sender, EventArgs e)
        {
            GuestStart7 guestStart = new GuestStart7();
            guestStart.Show();
            this.Hide();
        }

        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
